<script>
  const endpoint = 'https://jsonplaceholder.typicode.com/users'

  const fetchUsers = async () => {
    const response = await fetch(endpoint) // 返回的是一个 Response 对象
    console.log(response)

    if (!response.ok) throw new Error('Network response was not ok')
    await new Promise(resolve => {
      console.log('Waiting for 2 seconds...')
      setTimeout(resolve, 2000)
    })
    const data = await response.json()
    console.log(data)
  }

  // const fetchUsers = () => {

  // }s

  fetchUsers()
</script>
